package com.smbms.service.impl;

import com.smbms.dao.ProviderMapper;
import com.smbms.dao.UserMapper;
import com.smbms.entity.Provider;
import com.smbms.entity.User;
import com.smbms.service.ProviderService;
import com.smbms.service.UserService;
import com.smbms.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProviderServiceImpl implements ProviderService {

    @Autowired
    private ProviderMapper providerMapper;

    @Override
    public List<Provider> getList(Provider user) {
        return providerMapper.getListAll(user);
    }

    @Override
    public Provider getId(Integer id) {
        return providerMapper.getId(id);
    }

    @Override
    public Result save(Provider user) {
        int count=this.providerMapper.save(user);
        if(count==1) {
            return Result.reOk("新增成功");
        }else{
            return Result.reOk("新增失败");
        }
    }

    @Override
    public Result update(Provider user) {
        int count=this.providerMapper.updateProvider(user);
        if(count==1) {
            return Result.reOk("修改成功");
        }else{
            return Result.reOk("修改失败");
        }
    }


}
